package cn.springbak.publish.web.controller;

        import cn.springbak.publish.Service.SysLogService;
        import cn.springbak.publish.common.util.PageUtil;
        import cn.springbak.publish.pojo.SysLog;
        import cn.springbak.publish.web.pojo.JsonResult;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.*;

@RequestMapping("/log")
@RestController
public class SysLogController {
    @Autowired
    private SysLogService sysLogService;

    @DeleteMapping("{ids}")
    public JsonResult doDeleteById(@PathVariable Long... ids){
        sysLogService.deleteById(ids);
        return new JsonResult("delete ok");
    }

    @GetMapping("{id}")
    public JsonResult doFindById(@PathVariable Long id){
        return new JsonResult(sysLogService.findById(id));
    }

    @GetMapping("/doFindLogs")
    public JsonResult doFindLogs(SysLog sysLog){
        return new JsonResult(
                PageUtil.startPage().doSelectPageInfo(()->
                        sysLogService.findLogs(sysLog)
                ));
        //return new JsonResult(sysLogService.findLogs(sysLog));
    }
}
